<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/jsplib/pubhead.jsp"%>
<%@ taglib uri="/WEB-INF/c.tld"  prefix="c"%>
<%@ taglib prefix="myfn" uri="/WEB-INF/jstlfun.tld" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="x-ua-compatible" content="ie=7" />
	<TITLE>邀请好友:一点贷</TITLE>
	<link rel="stylesheet" type="text/css" href="${cpath}/css/gloabl.css"/>
	<link rel="stylesheet" type="text/css" href="${cpath}/css/oper.css" />
	<link rel="stylesheet" type="text/css" href="${cpath}/css/user.css">
	<script type="text/javascript" src="${cpath}/js/pophelp.js"></script>
</head>
<body>
<script> 
	//转页面
	var curUserID = '${userID}';
	if((curUserID == "")||(curUserID == null)){
		parent.window.location.replace("${cpath}/index.jsp"); 
	}
</script>

 	<!-- 页首 {{{ -->
	<%@ include file="/userhead.jsp"%>
   
	<div id="cont">
	<!-- 左边菜单栏 {{{ -->
	<%@ include file="/leftmenu.jsp"%>

	<div id="right">


	<!-- 右侧宽栏 {{{ -->
	<DIV class=profile_mid>
		<DIV class=content><!-- 右侧宽栏 }}}-->

		<div id="section-header">
				<ul id="nav-secondary">
					<li id="nav-on"><a href="#" ><span>邀请好友</span></a></li>
				</ul>
				<ul class="related-links">
					<li class="last"><img src="${cpath}/images/icon_help.png" alt="Help" title="Help"></li> 
				</ul>
		</div>
		<!--  {{{  -->
		<UL class=top>
			<LI><STRONG>&nbsp;</STRONG>&nbsp;&nbsp;
				<SPAN><a >发送邀请链接到好友email，或者复制邀请链接粘贴到你的QQ/MSN上推荐给你的好友。</a></SPAN>	
			</LI>
		</UL><!--   }}}-->

		<!--  {{{邀请好友-->
		<fieldset>
			<FORM name=sendForm action='${cpath}/invite.do?action=email' method=post>
			<UL class=detailinfo id="certForm" style="display:">
				<LI><STRONG>邀请链接:</STRONG><EM>
					${theForm.inviteURL}</EM></LI>
				<LI><STRONG>email:</STRONG><EM>
					<textarea name="email"  rows="5" cols="45"></textarea>&nbsp;&nbsp;<br>多个Email以空格分隔</EM></LI>
					<!--隐藏域-->
					<input type="hidden" name='invitorID' value='${theForm.invitorID}'/>
			</UL><!--结束 }}}-->
			<UL class=detailinfo>
			<li class=btn>	
				<input type="button" name="Copy" onclick="javascript:copyToClipBoard();" class="shortBtn" value="复制链接"/>&nbsp;
				<input type="button" name="Send" onclick="javascript:doSend();" class="shortBtn" value="发   送"/>
			</li>
			</UL>
			</form>
			<FORM name=theForm action='${cpath}/invite.do?action=list' method=post>
			<table class="addinfo">
					<thead>
						<tr align=left  bgcolor="#F2F3F6">
							<th width="10%">序号</th>
							<th width="25%">好友</th>
							<th width="10%">状态</th>
							<th width="20%">处理日期</th>								
							<th >&nbsp;</th>								
						</tr>
					</thead>
					<tbody>
					<c:forEach var="invite" items="${invitelist}" varStatus="status">   
					<tr align="left">  
					 <td><c:out value="${status.count}"></c:out></td>
					 <td><c:out value="${invite.userID}"></c:out></td>
					 <td>${myfn:getMsg("USER_STATUS",invite.status)}</td>
					 <td>${myfn:formatMMDD14(invite.MTime, "-")}</td>
					 <td>&nbsp;</td>
					</tr>   
					</c:forEach> 	
					<tr align="left">   
					 <td colspan="4">
						<!-- 分页主键 formName字段当前的form名称 -->
						<%@ include file="/jsplib/page.jsp" %>
						<!--隐藏域-->
						<input type="hidden" name='<%=ACTION%>' value='list'/>
						<input type="hidden" name='invitorID' value='${theForm.invitorID}'/>
					 </td>
					</tr>   
					</tbody>
			</table>
			</form>

		</fieldset><!--邀请好友 }}}-->


		</DIV><!-- content }}} -->
	</DIV><!-- profile_mid }}} -->

	<!-- 右边会员信息 {{{ -->
	<div class="right" style="margin-right:0px;">
		<%@ include file="/righthead.jsp"%>
	</div>

	</DIV><!--  right end}}} -->

</DIV><!--  cont end}}} -->
</body>
</html>
<!---->

<script>
  function copyToClipBoard(){ 
    var clipBoardContent="${theForm.inviteURL}"; 
    window.clipboardData.setData("Text",clipBoardContent); 
    alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友"); 
	} 
  /**
   * 检查项目资料维护
   */
	function doSend()
	{

		var re = /^[_a-zA-Z0-9\-\.]+@([\-_a-zA-Z0-9]+\.)+[a-zA-Z0-9]{2,3}$/;

		var form = document.sendForm;

		var email = form['email'].value;

		var invitorID = form['invitorID'].value;

		if(email.replace(/(^\s*)|(\s*$)/g,"").length ==0){

				alert("请输入【邮箱】\n");
				sendForm.email.focus();
				return false;
		}
 
		for(var i=0;i<email.length;i++)
		{   
		   strCode=email.charCodeAt(i);   
		   if((strCode>65248)||(strCode==12288)){   
					 alert("【邮箱】含全角字符，请切换输入法，输入半角字符");
					 sendForm.email.focus();
				   return false;
		   } 
		}  
		
		var emailArr=email.replace(/(^\s*)|(\s*$)/g,"").split(" ");

		for(var i=0; i< emailArr.length; i++){

			if (emailArr[i] == "" || (!emailArr[i].match(re)))
			{
				alert("【邮箱】不能为空或格式不符合规范\n");
				sendForm.email.focus();
				return false;
			}
		}
   form.submit();
	}

</script>

